package com.yantong.service;

import com.yantong.pojo.*;
import com.yantong.pojo.vo.CentreVo;
import com.yantong.utils.PageUtils;
import com.yantong.utils.SysUser;

import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author kanghaixin
 * @date 2018/8/24.16:29
 */
public interface CentreService {
    /**
     * 获取商户列表数据
     * @param name
     * @param type
     * @param status
     * @param offset
     * @param limit
     * @return
     */
    PageUtils<Centre> listCentres(SysUser user, String name, String type, String status, int offset, int limit);

    /**
     * 所有的商户列表
     * @return
     */
    List<Centre> listAllCentres();

    /**
     * 得到用户的商户
     * @return
     */
    Centre selectByMid(Long mid);

    /**
     * 校验商户名字是否已经存在
     * @param name
     * @return
     */
    Boolean checkName(String name);

    /**
     * 新增商户信息
     * @param centre
     * @return
     */
    int save(Centre centre);

    /**
     * 新增商户信息
     * @param centre
     * @return
     */
    int saveCentre(CentreVo centre);

    /**
     * 商户详情
     * @param centreId
     * @return
     */
    Centre getByKey(Long centreId);

    /**
     * 商户详情
     * @param centreId
     * @return
     */
    Centre getBymid(Long mid);

    /**
     * 更新商户
     * @param centre
     * @return
     */
    int updateCentre(Centre centre);

    /**
     * 停用商户
     * @param centreId
     * @return
     */
    int removeCentre(Long centreId);

    /**
     * 恢复商户
     * @param centreId
     * @return
     */
    int resumeCentre(Long centreId);

    /**
     * 批量停用
     * @param centreIds
     * @return
     */
    int batchRemove(List<Long> centreIds);

    /**
     * 批量隐藏
     * @param centreIds
     * @return
     */
    int batchHiden(List<Long> centreIds, Integer hide);

    /**
     * 全部隐藏
     * @param centreIds
     * @return
     */
    int batchAllHiden(Integer hide);


    /**
     * 获取商户费率
     * @param centreId
     * @return
     */
    CentreRate getRateByCentreId(Long centreId);

    /**
     * 获取商户账户详情
     * @param centreId
     * @return
     */
    CentreAmount getAmountByCentreId(Long centreId);

    /**
     * 更新商户账户信息
     * @param centreAmount
     * @return
     */
    int changeAmount(CentreAmount centreAmount);

    /**
     * 账户流水记录列表
     * @param centreId
     * @param start
     * @param end
     * @param orderSn
     * @param offset
     * @param limit
     * @return
     */
    List<AmountLog> getListAmountLogs(Long centreId, Date start, Date end, String orderSn, Integer flowType, int offset, int limit);

    /**
     * 保存账户流水记录
     * @param amountLog
     * @return
     */
    int saveAmountLog(AmountLog amountLog);

    /**
     * 保存账户流水记录
     * @param orderId
     * @param centreId
     * @param op
     * @param orderSn
     * @return
     */
    int saveAmountLog(Long orderId, Long centreId, OrderProduct op, String orderSn);
//
    /**
     * 扣除商户余额
     * @param centreId
     * @param money
     * @param orderSn
     * @param orderProductId
     * @param remark
     * @return
     */
    int deductAmount(Long centreId, BigDecimal money, String orderSn, Long orderProductId, Integer flowType, String remark);

    /**
     * 扣除商户余额
     * @param centreId
     * @param money
     * @param orderSn
     * @param orderProductId
     * @return
     */
    int supplyDeductAmount(Long centreId, BigDecimal money, String orderSn, Long orderProductId);

    /**
     * 后台扣减商户余额
     */
     int reduceAmount(CentreAmount centreAmount, String remark);
    Centre getCentreById(Long centreId);
    PageUtils<Centre> chooseCentreTable(String queryItem, int offset, int limit);

    Boolean checkExpriedDate(Long centreId);

    int checkCentre(Long centreId);
    Centre getPlatCenter();
}
